#pragma once
#ifdef FAXUSBMANAGER_EXPORTS
#define FAXUSBMANAGER_API __declspec(dllexport)
#else
#define FAXUSBMANAGER_API __declspec(dllimport)
#endif
#include "faxBackupUsbManagerCommon.h"

#include <vector>
using namespace std;

//typedef struct _APP_CONFIG_NAME_LIST
//{
//	char m_appNameList[TAX_MAX_SUPPORTED_APP_COUNT][FAX_APP_NAME_LENGTH];
//	int m_count;
//}APP_CONFIG_NAME_LIST, *PAPP_CONFIG_NAME_LIST;
struct FILE_BACKUP_INFO
{
	char m_alas[MAX_PATH];
	char m_relatePathName[MAX_PATH];
};

class FileBackup
{
public:
	FileBackup();
	~FileBackup();
	FileBackup(const FileBackup &fileBackup);
	virtual FileBackup& operator = (const FileBackup&);
	vector<FILE_BACKUP_INFO> m_fileToBackupList;
	void AddFileToBackup(const char *alas, const char *relateFilePath);
	void Backup(const char * installPath);
	void Recover(const char * installPath);
};

class FAXUSBMANAGER_API AppConfig
{
public:
	AppConfig(void);
	virtual ~AppConfig(void);
	AppConfig(const AppConfig &config);
	virtual AppConfig& operator = (const AppConfig&);
	virtual BOOL IsMyInstallPath( char *installPath );
	virtual BOOL IsMyExeFile(char *exeFilePathName);
	virtual BOOL GetInstallPathByAppExeName(char *exePathName, char *installPath);
	virtual BOOL GetInstallPathByExePath(char *exePath, char *installPath);
	virtual void SetExeName(const char *exeName);
	virtual void SetExePath(const char *exePath);
	virtual void SetDbFileName(const char *dbFileName);
	virtual void SetAppName(const char *appName);
	virtual void SetDbFilePath(const char *dbFilePath);
	virtual void SetDefaultLnkPathName(const char *defaultLnkPathName);
	virtual BOOL GetAppKeyName(char *appKeyName);
	virtual BOOL GetExePathName(char *exePathName);
	virtual BOOL GetExePath(char *exePath);
	virtual BOOL GetExeName(char *exeName);
	virtual BOOL GetDbFilePathName(char *dbFilePathName);
	virtual BOOL GetDbFileName(char *dbFileName);
	virtual BOOL GetDbFilePath(char *dbFilePath);
	virtual BOOL GetDefaultLnkPathName(char *defaultLnkPathName);
	virtual void AddFileToBackup(const char *alas, const char *relateFilePath);
	virtual void Backup(const char * installPath);
	virtual void Recover(const char * installPath);
protected:
	char m_appName[FAX_APP_NAME_LENGTH];
	char m_exeName[MAX_PATH];
	char m_exePath[MAX_PATH];
	char m_dbFileName[MAX_PATH];
	char m_dbFilePath[MAX_PATH];
	char m_defaultLnkPathName[MAX_PATH];
	FileBackup m_fileBackup;
	BOOL FileExist( char *filePathName );
};


extern "C" FAXUSBMANAGER_API AppConfig *CreateAppConfigObject();
extern "C" BOOL FAXUSBMANAGER_API GetConfigBySerialNum(char *serialNum, AppConfig &config);
extern "C" bool FAXUSBMANAGER_API GetExeNameBySerialNum(char *serialNum, char *exeName);
//BOOL FAXUSBMANAGER_API GetAvailableAppList(APP_CONFIG_NAME_LIST &appConfigNameList);
